Skip to main content
POST
/
toptimize
/
v1
/
rank
[Beta] Rank objects
curl --request POST \
  --url https://api.topsort.com/toptimize/v1/rank \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "ranking": [
    {
      "type": "listings",
      "slots": 3,
      "pageSize": 3,
      "category": {
        "ids": [
          "sneakers",
          "shoes"
        ]
      },
      "products": {
        "ids": [
          "p_PJbnN",
          "p_ojng4"
        ]
      }
    }
  ]
}'
{
  "results": [
    {
      "products": [
        {
          "rank": 1,
          "type": "organic",
          "id": "p_Mfk11",
          "resolvedItemId": "WyJiX01mazExIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTMyNjYtY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0=="
        },
        {
          "rank": 2,
          "type": "sponsored",
          "id": "p_Mfk15",
          "resolvedItemId": "WyJiX01mazE1IiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0="
        },
        {
          "rank": 3,
          "type": "organic",
          "id": "p_PJbnN",
          "resolvedItemId": "WyJlX1BKYm5OIiwiMTJhNTU4MjgtOGVhZC00Mjk5LTgzMjctY2ViYjAwMmEwZmE4IiwibGlzdGluZ3MiLCJkZWZhdWx0IiwiIl0="
        }
      ],
      "error": false
    }
  ]
}

Authorizations

Authorization
string
header
required

A valid API key generated in Topsort's UI.

Body

application/json

The context information to get the ranking, to rank organic and sponsored products.

ranking
object[]
required
Required array length: 1 - 5 elements

Response

The ranking results. The list of winners will contain at most slots entries per auction. It may contain fewer or no entries at all if there aren't enough products to fill the slots.

results
object[]
required
Required array length: 1 - 5 elements
I